{literal}
<script type="text/javascript" charset="utf-8">

	$(document).ready(function(){
			
			$("input[@type='file']").change( function() {
				// check input ($(this).val()) for validity here
				ext = ($(this).val());
				ext = ext.substring(ext.length-3,ext.length);
				ext = ext.toLowerCase();
				if(ext == 'flv' || ext == 'swf' || ext == 'mov' || ext == 'avi') {
					$('#wymiary_').css('display','block');
				}else{
					$('#wymiary_').css('display','none');
				}
 		  });

			$("#edit_section").submit(function() {
				return__ = true;
				ext = ($('#file_').val());
				ext = ext.substring(ext.length-3,ext.length);
				ext = ext.toLowerCase();
				if(ext == 'flv' || ext == 'swf' || ext == 'mov' || ext == 'avi') {
						
					if ($("#width_").val() == "" || $("#width_").val() == 0) {
						alert('Proszę podać szerokość.');
						return false;
					}else{
						return__ = (return__) ? true : false ;
					}
	
					if ($("#height_").val() == "" || $("#height_").val() == 0) {
						alert('Proszę podać wysokość.');
						return false;
					}else{
						return__ = (return__) ? true : false ;
					}
				}
				return return__;
		    });	
		    		
	});

</script>
<style type="text/css">
		.thumbnail{
			cursor: pointer;
			background: #FFFFFF;
			background-position: center center;
			float: left	;
			visibility: visible;
			background-repeat: no-repeat; 
			margin:0px;
			padding: 2px;
			border: solid 1px #EEEEEE;
		}
</style>
{/literal}
<form id="edit_section" name="edit_section" enctype="multipart/form-data"  action="{$smarty.const.HTTP_URL}{$section.page_url},Panel_Panel,saveedisec,user.html" method="post">
<input type="hidden" name="id_page" value="{$section.id_page}"/>
<input type="hidden" name="id_section" value="{$section.id_section}"/>
<input type="hidden" name="id_lang" value="{$section.id_lang}"/>

<span id="exten_body__" style="display: none;">{$section.exten_body}</span>
<input type="hidden" name="exten_body" id="exten_body" value="{$section.id_exten}"/>
<input type="hidden" name="id_exten" id="id_exten"  value="{$section.id_exten}"/>
		
<table class="setup">
	<tr>
	<th>Nazwa strony</th><td>{$section.page_name}</td>
	</tr>
	<tr>
	<th>Treść wyswietlana zawsze</th><td><textarea class="htmledytor" name="section_body" id="section_body__" rows="35" cols="30" style="height: 450px;">{$section.section_body}</textarea></td>
	</tr>
	<tr>
	<th>Treść znikająca po zalogowaniu użytkownika</th><td><textarea class="htmledytor" name="section_body_sometime" id="section_body_sometime__" rows="35" cols="30" style="height: 250px;">{$section.section_body_sometime}</textarea></td>
	</tr>	
	<tr>
	<th>Treść dostępna dla użytkownika tylko po zalogowaniu</th><td><textarea class="htmledytor" name="section_body_hidden" id="section_body_hidden__" rows="35" cols="30" style="height: 250px;">{$section.section_body_hidden}</textarea></td>
	</tr>	
	<tr>
	<th>Blokowanie / odblokowanie sekcji</th><td><input type="checkbox" name="plock" {if $section.plock eq 1} value="1" checked="checked"{/if} onclick="if(this.checked){ldelim} this.value = 1 {rdelim}else{ldelim}this.value = 0{rdelim}"/></td>
	</tr>
	<tr>
	<th>Ostatnia modyfikacja</th><td>{$section.last_modification}</td>
	</tr>
	<tr>
	<th>Dodaj plik
	</th>
	<td>	<input type="file" name="file" id="file_" /> max. wielkość pliku 2MB<br/>
		<div id="wymiary_" style="display: none;">Szerokość:<input name="width" id="width_" value="" /> Wysokość:<input name="height" id="height_" value="" /></div>
		<br/>
	[jpg;jpeg;] - zdjęcia<br/>
	[doc;xls;txt;pdf;...] - dokumenty<br/>
	[zip;rar;tgz;...] - archiwa<br/>
	[swf;flv;avi;mp3] - multimedialne<br/>
	</td>
	</tr>
	<tr>
	<th>Pliki</th>
		<td>
			<table cellpadding="0" cellspacing="0" width="100%">
			
			{if isset($fFotos)}
			<tr><th>Zdjęcia</th><th colspan="2">adres url</th></tr>
			{section name=idf loop=$fFotos}
			<tr>
			<td width="5%"><div class="thumbnail" style="background-image: url({$smarty.const.HTTP_URL}photo,{$fFotos[idf].path}{$fFotos[idf].name},50,50,100.html); width: 50px; height: 40px; float:left;"></div></td>
			<td width="90%"><input readonly="readonly" value="{$fFotos[idf].path}{$fFotos[idf].name}" style="width: 100%"/></td>
			<td width="5%"><input type="button" value="Usuń" onclick="document.location='{$smarty.const.HTTP_URL}delFile,Panel_Files,deleteFile.html?path={$fFotos[idf].path}&name={$fFotos[idf].name}&redirectTo=sekcja,{$section.id_page},{$section.id_section},{$section.id_lang}.html';"/></td>
			</tr>
			{/section}
			{/if}
			
			{if isset($fDoc)}
			<tr><th>Dokumenty</th><th colspan="2">adres url</th></tr>
			{section name=id loop=$fDoc}
			<tr>
			<td>[{$fDoc[id].typ}]</td>
			<td><input readonly="readonly" value="{$fDoc[id].path}{$fDoc[id].name}" style="width: 100%"/></td>
			<td><input type="button" value="Usuń" onclick="document.location='{$smarty.const.HTTP_URL}delFile,Panel_Files,deleteFile.html?path={$fDoc[id].path}&name={$fDoc[id].name}&redirectTo=sekcja,{$section.id_page},{$section.id_section},{$section.id_lang}.html';"/></td>
			</tr>
			{/section}
			{/if}

			{if isset($fArch)}
			<tr><th>Pliki archiwalne</th><th colspan="2">adres url</th></tr>
			{section name=id loop=$fArch}
			<tr>
			<td>[{$fArch[id].typ}]</td>
			<td><input readonly="readonly" value="{$fArch[id].path}{$fArch[id].name}" style="width: 100%"/></td>
			<td><input type="button" value="Usuń" onclick="document.location='{$smarty.const.HTTP_URL}delFile,Panel_Files,deleteFile.html?path={$fArch[id].path}&name={$fArch[id].name}&redirectTo=sekcja,{$section.id_page},{$section.id_section},{$section.id_lang}.html';"/></td>
			</tr>
			{/section}
			{/if}	
			
			{if isset($fVideo)}
			<tr><th>Pliki video</th><th colspan="2">adres url</th></tr>
			{section name=id loop=$fVideo}
			<tr>
			<td>[{$fVideo[id].typ}]</td>
			<td><input readonly="readonly" value="{$fVideo[id].path}{$fVideo[id].name}" style="width: 100%"/></td>
			<td><input type="button" value="Usuń" onclick="document.location='{$smarty.const.HTTP_URL}delFile,Panel_Files,deleteFile.html?path={$fVideo[id].path}&name={$fVideo[id].name}&redirectTo=sekcja,{$section.id_page},{$section.id_section},{$section.id_lang}.html';"/></td>
			</tr>
			{/section}
			{/if}
			
			{if isset($fAudio)}
			<tr><th>Pliki audio</th><th colspan="2">adres url</th></tr>
			{section name=id loop=$fAudio}
			<tr>
			<td>[{$fAudio[id].typ}]</td>
			<td><input readonly="readonly" value="{$fAudio[id].path}{$fAudio[id].name}" style="width: 100%"/></td>
			<td><input type="button" value="Usuń" onclick="document.location='{$smarty.const.HTTP_URL}delFile,Panel_Files,deleteFile.html?path={$fAudio[id].path}&name={$fAudio[id].name}&redirectTo=sekcja,{$section.id_page},{$section.id_section},{$section.id_lang}.html';"/></td>
			</tr>
			{/section}
			{/if}							
			</table>

		</td>
	</tr>
	<tr>
		<th class="no_border"></th>
		<td class="no_border">
			<input type="submit" class="button" value="Zapisz sekcje"/>
			<input type="button" class="button" value="Zrezygnuj" onclick="document.location='{if $section.redirect eq 1}{$section.to_url}.html{else}{$smarty.const.HTTP_URL}{$section.page_url}.html{/if}'"/>
			<input type="button" class="button" id="podglad_strony" value="Podgląd strony" onclick="document.location='{if $section.redirect eq 1}{$section.to_url}.html{else}{$smarty.const.HTTP_URL}{$section.page_url}.html{/if}';">
		</td>
	</tr>
	
	


</table>

</form>
